package com.lsl.gulimall.auth.controller;

import com.lsl.common.utils.R;
import com.lsl.gulimall.auth.service.LoginService;
import com.lsl.gulimall.auth.vo.RegisterUserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Zed
 * @description
 * @date 2022/10/16 14:41
 */
@RestController
@RequestMapping("login/loginUser")
public class LoginController {

    @Autowired
    private LoginService loginService;

    /**
     * 手机号验证码发送
     */
    @RequestMapping("/sendCode")
    public R sendCode(@RequestParam String phone) {
        return loginService.sendCode(phone);
    }


    /**
     * 注册会员
     */
    @RequestMapping("/registerUser")
    public R validCode(@RequestBody RegisterUserVo registerUserVo) {
        return loginService.validCode(registerUserVo);
    }
}
